package com.define.commons.demo.controller;

import com.define.commons.demo.domain.Teacher;
import com.define.commons.demo.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import com.define.commons.common.base.BaseController;
import com.define.commons.common.utils.RS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author xiewenlong
 * @Date 2018/11/19 10:10
 */
@Slf4j
@RestController
@RequestMapping("teacher")
public class TeacherController extends BaseController {

    @Autowired
    private TeacherService service;

    /**
     * 一对多
     */
    @GetMapping("full")
    RS full(){
        Teacher teacher = service.full();
        System.out.println(teacher);
        System.out.println(teacher.getStudents());
        return new RS(teacher);
    }
}
